<ion-view id="amazon" hide-tabs>
  <ion-nav-bar class="bar-royal">
    <ion-nav-back-button>
    </ion-nav-back-button>
    <ion-nav-title>{{'Buy'|translate}}</ion-nav-title>
  </ion-nav-bar>

  <ion-content class="add-bottom-for-cta">
    <!-- BUY -->
    <div class="list">

      <div class="item head">
        <div class="sending-label">
          <i class="icon big-icon-svg">
            <div class="bg icon-amazon"></div>
          </i>
          <span>Amazon.com Gift Card</span>
        </div>
        <div class="amount-label">
          <div class="amount">{{amountUnitStr}}</div>
          <div class="alternative">
            {{limitPerDayMessage}}
          </div>
        </div>
      </div>

      <div class="info">
        <div class="item item-icon-right" ng-click="showWalletSelector()">
          <div class="label" translate>From</div>
          <div class="wallet">
            <i class="icon big-icon-svg">
              <img ng-src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : 'icon-wallet'}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg">
            </i>
            {{wallet ? wallet.name : '...'}}
          </div>
          <i class="icon bp-arrow-right"></i>
        </div>
        <div ng-show="totalAmountStr">
          <div class="item item-divider" translate>
            Details
            <i class="icon ion-ios-help-outline details" ng-click="openExternalLink('https://support.bitpay.com/hc/en-us/articles/203076826-What-fees-will-I-pay-when-I-pay-a-BitPay-merchant-with-bitcoin-or-load-the-BitPay-Card-')"></i>
          </div>
          <div class="item">
            <span translate>Gift Card</span>
            <span class="item-note">
              {{amount | currency:'$ ':2}}<span ng-if="amount"> {{currencyIsoCode}}</span>
            </span>
          </div>
          <div class="item">
            <span translate>Network Cost</span>
            <span class="item-note">
              <span>{{invoiceFee | currency:'$ ':2}}<span ng-if="invoiceFee"> {{currencyIsoCode}}</span>
            </span>
          </div>
          <div class="item">
            <span translate>Miner Fee</span>
            <span class="item-note">
              <span>{{networkFee | currency:'$ ':2}}<span ng-if="networkFee"> {{currencyIsoCode}}</span>
            </span>
          </div>
          <div class="item">
            <span translate>Total</span>
            <span class="item-note">
              <span ng-if="totalAmount">{{totalAmount | currency:'$ ':2}} {{currencyIsoCode}}</span>
              <span ng-if="totalAmountStr">({{totalAmountStr}})</span>
            </span>
          </div>
        </div>
        <div class="item item-divider"></div>
        <div class="item size-12">
          * <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a> is not a sponsor of this promotion.
          Except as required by law, <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a>
          Gift Cards ("GCs") cannot be transferred for value or redeemed for cash. GCs may be used only for purchases of
          eligible goods at <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a> or certain of its
          affiliated websites. For complete terms and conditions, see
          <a ng-click="openExternalLink('https://www.amazon.com/gc-legal')">www.amazon.com/gc-legal</a>.
          GCs are issued by ACI Gift Cards, Inc., a Washington corporation. All Amazon &reg;, &trade; &amp; &copy; are IP
          of <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a>, Inc. or its affiliates.
          No expiration date or service fees.
        </div>
      </div>
    </div>

  </ion-content>

  <click-to-accept
    ng-click="buyConfirm()"
    ng-if="!isCordova"
    click-send-status="sendStatus"
    is-disabled="!wallet || !totalAmountStr">
    {{'Confirm purchase'|translate}}
  </click-to-accept>
  <slide-to-accept
    ng-if="isCordova && wallet && totalAmountStr"
    slide-on-confirm="buyConfirm()"
    slide-send-status="sendStatus">
    {{'Slide to buy'|translate}}
  </slide-to-accept>
  <slide-to-accept-success
    slide-success-show="sendStatus === 'success'"
    slide-success-on-confirm="goBackHome()"
    slide-success-hide-on-confirm="true">
    <span ng-show="amazonGiftCard.status == 'FAILURE'" translate>
      Your purchase could not be completed
    </span>
    <span ng-show="amazonGiftCard.status == 'PENDING'" translate>
      Your purchase was added to the list of pending
    </span>
    <span ng-show="amazonGiftCard.status == 'SUCCESS'" translate>
      Bought {{amountUnitStr}}
    </span>
    <div class="m10 size-14" ng-show="amazonGiftCard.status == 'SUCCESS'" translate>
      Gift card generated and ready to use.
    </div>
  </slide-to-accept-success>

  <wallet-selector
    wallet-selector-title="walletSelectorTitle"
    wallet-selector-wallets="wallets"
    wallet-selector-selected-wallet="wallet"
    wallet-selector-show="showWallets"
    wallet-selector-on-select="onWalletSelect">
  </wallet-selector>
</ion-view>
